<?php

namespace app\index\controller;

use app\admin\model\Service;
use app\index\model\User;
use app\service\model\Chatlog;
use think\Controller;
use think\Session;

class Base extends Controller
{
    protected $wechat_user = [];
    public function _initialize()
    {
        $wechat_user = Session::get('wechat_user');
        if (!$wechat_user) {
            $wechat_user = \app\wechat\model\OauthUser::find(request()->get('id', 1));
            if ($wechat_user) {
                Session::set('wechat_user', $wechat_user);
            } else {
                return $this->redirect('wechat/user/login');
            }
        }
        $this->wechat_user = $wechat_user;
    }
}